<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>mapping lang to -webkit-locale</title>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p>This is a test for <a href="http://webkit.org/b/67586">bug 67586</a>. HTML attributes lang and xml:lang are mapped to '-webkit-locale' to use their value in font fallback.</p>
<div id="console"></div>
<div xml:lang="ja" lang="en" id="x1"><div id="x2"><div id="x3"></div></div></div>
<div lang="zh" id="l1"><div id="l2"><div id="l3"></div></div></div>
<div lang="ko" id="m1"><div lang="fr" xml:lang="fr" id="m2"><div id="m3"></div></div></div>
<div xml:lang="fr" id="n1"><div id="n2"><div lang="sv" id="n3"></div></div></div>
<div xml:lang="ja" id="p1"><div lang="" id="p2"></div></div>
<div lang="ja" id="q1">
    <div lang="" id="q2"></div>
    <div xml:lang="" id="q3"></div>
    <div xml:lang="ar" id="q4"><div xml:lang="" id="q5"></div></div>
    <div lang="  " id="q6"></div>
    <div lang="auto" id="q7"></div>
    <div lang="xyzzy" id="q8"></div>
    <div lang="][;][[" id="q9"></div>
</div>
<script>
function languageOfNode(id) {
    var element = document.getElementById(id);
    return window.getComputedStyle(element).webkitLocale;
}
shouldBeEqualToString("languageOfNode('x1')", '"ja"');
shouldBeEqualToString("languageOfNode('x2')", '"ja"');
shouldBeEqualToString("languageOfNode('x3')", '"ja"');
shouldBeEqualToString("languageOfNode('l1')", '"zh"');
shouldBeEqualToString("languageOfNode('l2')", '"zh"');
shouldBeEqualToString("languageOfNode('l3')", '"zh"');
shouldBeEqualToString("languageOfNode('m1')", '"ko"');
shouldBeEqualToString("languageOfNode('m2')", '"fr"');
shouldBeEqualToString("languageOfNode('m3')", '"fr"');
shouldBeEqualToString("languageOfNode('n1')", '"fr"');
shouldBeEqualToString("languageOfNode('n2')", '"fr"');
shouldBeEqualToString("languageOfNode('n3')", '"sv"');
shouldBeEqualToString("languageOfNode('p1')", '"ja"');
shouldBeEqualToString("languageOfNode('p2')", "auto");
shouldBeEqualToString("languageOfNode('q1')", '"ja"');
shouldBeEqualToString("languageOfNode('q2')", "auto");
shouldBeEqualToString("languageOfNode('q3')", "auto");
shouldBeEqualToString("languageOfNode('q4')", '"ar"');
shouldBeEqualToString("languageOfNode('q5')", "auto");
shouldBeEqualToString("languageOfNode('q6')", '"  "');
shouldBeEqualToString("languageOfNode('q7')", '"auto"');
shouldBeEqualToString("languageOfNode('q8')", '"xyzzy"');
shouldBeEqualToString("languageOfNode('q9')", '"][;][["');

var successfullyParsed = true;
</script>
</body>
</html>

